/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-12-15 15:21:28
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 列表查询
export const getList = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/productInfo/getInfo`, {params})
// 新增
export const addSave = (params) => axios.post(`${SERVER.BASEDATA}/vehicleProduct/productInfo/saveInfo`, params)
// 编辑
export const emitSave = (params) => axios.post(`${SERVER.BASEDATA}/vehicleProduct/productInfo/saveInfo`, params)
// 是否可订购
export const updateOrderStatus = (params) => axios.post(`${SERVER.BASEDATA}/vehicleProduct/productInfo/updateOrderStatus`, params)
// 下发产品信息
export const issueInfo = (params) => axios.post(`${SERVER.BASEDATA}/vehicleProduct/productInfo/issueInfo`, params)
// 车辆配置五级选择
export const vehicleConfiguration = (id, params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/productInfo/productTreeNew`, { params: { type: id, level: 6, ...params } });
// 品牌列表
export const getAllbrand = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/queryBrandDictAll`, { params })
// 车系列表
export const getAllseriess = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/brandsdict/${params.brandId}/seriessdictAll`, { params })
// 车型列表
export const getAllmodels = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/brandsdict/${params.brandId}/seriessdictAll/${params.seriesId}/modelsdictAll`, { params })
// 配置列表
export const getAllpackage = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/brandsdict/${params.brandId}/seriessdictAll/${params.seriesId}/modelsdictAll/${params.modelId}/packagedictAll`, { params })
// 选装列表
export const getAlloption= (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/brandsdict/${params.brandId}/seriessdictAll/${params.seriesId}/modelsdictAll/${params.modelId}/packagedictAll/${params.packageId}/optiondictAll`, { params })
// 内饰列表
export const getAllInterior = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/colors/colorinfo/Interior`, { params })
// 外饰列表
export const getAllexterior= (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/colors/colorinfo/exterior`, { params })
// 导入模板下载
// export const excelList1 = (params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/productInfo/exportProduct/excel`, params,{responseType: 'blob'})
export const excelList = params => {
  const url = `${SERVER.BASEDATA}/vehicleProduct/productInfo/exportProduct/excel`;
  return axios({
    url,
    method: 'get',
    responseType: 'blob',
    params:params,
  });
};
export const excelList1 = params => {
  const url = `${SERVER.BASEDATA}/vehicleProduct/productInfo/exportProductExportProductsTemplate/excel`;
  return axios({
    url,
    method: 'get',
    responseType: 'blob',
    params:params,
  });
};
// 查询所有员工
export const getDealerUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);

// / 导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
